const Router = require('koa-router');
const router = new Router();
const {db,QueryTypes } = require("../../models/db");
// 获取页面设置
router.post('/subject/list', async ctx => {
    let tenantId = ctx.user.tenantId;
    let sql = `select a.id,a.code,a.direct,a.name,a.fullName,a.pid,b.name pidName from category a left join category b on a.tenantId = b.tenantId and a.pid = b.id
where a.tenantId = ${tenantId} and a.typeNumber = 'subject' and a.disabled = 0`;
    let ret = await db.query(sql, {type: QueryTypes.SELECT})
    return ctx.suc('', {list: ret});
})


module.exports = router;